package com.example.video_encoder;

public class SoftwareEncoder {
    private int mWidth;
    private int mHeight;
    // Used to load the 'native-lib' library on application startup.
    static {
        System.loadLibrary("software_codec");
    }

    public String getString() {
        return stringFromJNI();
    }

    public void start(int width, int height) {
        mWidth = width;
        mHeight = height;
        StartEncoder(mWidth, mHeight);
    }

    public void stop() {
        StopEncoder();
    }

    public int encode(byte[] I420Data, byte[] nalData) {
       int nal_size;
       nal_size = EncodeFrame(I420Data, nalData);
       return nal_size;
    }
    /**
     * A native method that is implemented by the 'native-lib' native library,
     * which is packaged with this application.
     */
    public native String stringFromJNI();
    public native long StartEncoder(int width, int height);
    public native long StopEncoder();
    public native int EncodeFrame(byte[] I420Data, byte[] nalData);
}
